import pyperclip
import convert
import time
import colorful

last_data = ""
while True:
    time.sleep(0.2)
    try:
        data = pyperclip.paste()
        has_alnum = False
        for char in data:
            if char.isalnum():
                has_alnum = True
                break
        if has_alnum == False:
            continue
        if data == last_data:
            continue
        print("input = \n{}".format(colorful.green(data)))
        data = convert.convert(data)
        print("output = \n{}".format(colorful.green(data)))
        last_data = data
        pyperclip.copy(data)
    except:
        import traceback
        print(colorful.red(traceback.format_exc))